<html>
<head><meta charset="utf-8"><title>std won&#x27;t build with Rust 1.43.1, LLVM 7.1 for PPC OS X · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html">std won&#x27;t build with Rust 1.43.1, LLVM 7.1 for PPC OS X</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="232881850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232881850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Erno Palonheimo <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232881850">(Apr 02 2021 at 10:01)</a>:</h4>
<p>I've spent a couple of evenings with Rust trying to get it to produce binaries for this unsupported platform. I chose these versions because LLVM 7.1.0 is the last one with official PPC Darwin support. When building with <code>x.py --target=powerpc-apple-darwin.json</code> I'm getting this:</p>
<div class="codehilite"><pre><span></span><code>LLVM ERROR: symbol &#39;_GLOBAL_OFFSET_TABLE_&#39; can not be undefined in a subtraction expression
error: could not compile `std`.
</code></pre></div>
<p>Here is my current target specification JSON, based mostly on creative cut'n'paste from the i686 Darwin and ppc Linux target specs. <a href="/user_uploads/4715/QEj21OfMs8ESmUpBkg7rGME_/powerpc-apple-darwin.json">powerpc-apple-darwin.json</a></p>
<p>When running build with <code>-vv</code> I get the exact command that's failing but am having a slightly hard time figuring out what is amiss. I know next to nothing about Rust compiler internals but the concept of GOT is somewhat familiar to me. I'm guessing this is happening because something in there would like to refer to a symbol via the GOT, but the GOT base address is not specified at all and thus this fails. I did manually specify PIC relocation model in the target JSON hoping this would trigger something in there to emit the <code>_GLOBAL_OFFSET_TABLE_</code> symbol but still get the same result.</p>
<p>FWIW, with C the LLVM/CLang combo produces object files which can be copied over to the PPC Mac, linked there and successfully executed.</p>
<p>If you can point me in some direction, that'd be highly appreciated.</p>



<a name="232882944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232882944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232882944">(Apr 02 2021 at 10:14)</a>:</h4>
<p>I don't think rust supports anything earlier than llvm 10</p>



<a name="232882994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232882994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232882994">(Apr 02 2021 at 10:15)</a>:</h4>
<p>At least currently, you might be able to go back far enough that its supported. But then you'll run into other bugs that have been fixed in the meantime.</p>



<a name="232883043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232883043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232883043">(Apr 02 2021 at 10:16)</a>:</h4>
<p>Have you tried a more recent version of llvm yet?</p>



<a name="232883265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232883265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Erno Palonheimo <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232883265">(Apr 02 2021 at 10:18)</a>:</h4>
<p>Rust 1.43.1 should work with llvm 7.1 (source: build system version check) and I'm not expecting a bug-free experience. As I mentioned, llvm 7.1 is the last one with official support for the target. I could take a stab at backporting support to a later llvm or alternatively try an older Rust version with an older llvm, just to isolate it a bit.</p>



<a name="232899409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232899409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232899409">(Apr 02 2021 at 13:38)</a>:</h4>
<p>I would suspect its a bug in LLVM, probably correlated with rustc using llvm in ways that are more off the beaten path compared to clang.</p>



<a name="232899449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232899449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232899449">(Apr 02 2021 at 13:38)</a>:</h4>
<p>for one PPC prefers TOC relocations to GOT ones.</p>



<a name="232899505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232899505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232899505">(Apr 02 2021 at 13:39)</a>:</h4>
<p>so I could see a bug being that LLVM emits TOC relocations everywhere, except in some hardcoded location and since its emitting TOC relocs everywhere it doesn't bother creating the GOT table.</p>



<a name="232902898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232902898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Erno Palonheimo <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232902898">(Apr 02 2021 at 14:10)</a>:</h4>
<p>Thanks for the insight. The theory is plausible, I'll try to look into it and see what's going on. I'll see if I can get a bit more room for bisection by targeting an older Rust version first, as then I'll have a wider range of OS X PPC-supporting LLVMs to try this with. Not that anything guarantees that it has ever worked, but trying it out won't take that long.</p>
<p>1.43.1 wants 7.0 at least and all 7.x behave similarly.</p>



<a name="232903921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232903921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232903921">(Apr 02 2021 at 14:19)</a>:</h4>
<p>Might be better to find which rust version used LLVM 7 <em>at most</em></p>



<a name="232904488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232904488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Erno Palonheimo <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232904488">(Apr 02 2021 at 14:24)</a>:</h4>
<p>The version check in <code>src/bootstrap/native.rs</code> doesn't specify an upper limit for LLVM version number since 1.23.0, it seems. Older ones seemed to have specific sets of LLVM 3.x releases they wanted.</p>



<a name="232905032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232905032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232905032">(Apr 02 2021 at 14:29)</a>:</h4>
<p>If you install a version on a supported system, <code>rustc -Vv</code> will tell you its LLVM version.</p>



<a name="232905170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232905170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232905170">(Apr 02 2021 at 14:30)</a>:</h4>
<p>Or from source, check out a tag, update submodules, and see the LLVM cmake</p>



<a name="232905494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232905494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232905494">(Apr 02 2021 at 14:33)</a>:</h4>
<p>Ah, it's in the release notes for 1.29, "Upgraded to LLVM 7."</p>



<a name="232905641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232905641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Erno Palonheimo <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232905641">(Apr 02 2021 at 14:34)</a>:</h4>
<p>Thanks! Was just going backwards through the tags but didn't get that far yet.</p>



<a name="232905939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232905939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232905939">(Apr 02 2021 at 14:37)</a>:</h4>
<p>Should probably use 1.29.2 to avoid noalias bugs</p>



<a name="232906054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/std%20won%27t%20build%20with%20Rust%201.43.1%2C%20LLVM%207.1%20for%20PPC%20OS%20X/near/232906054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/std.20won&#x27;t.20build.20with.20Rust.201.2E43.2E1.2C.20LLVM.207.2E1.20for.20PPC.20OS.20X.html#232906054">(Apr 02 2021 at 14:38)</a>:</h4>
<p>Then 1.30 upgraded to LLVM 8, so 7 had a short window!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>